package com.ly.ocw.service.weixin;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.ly.ocw.entity.weixin.WeixinUserCardStat;
import com.ly.ocw.repository.weixin.WeixinUserCardStatDao;

/**
 * 统计service
 * 
 * @author Peter
 */
// Spring Service Bean的标识.
@Component
public class WeixinUserCardStatService {

	private static Logger logger = LoggerFactory.getLogger(WeixinUserCardStatService.class);

	@Autowired
	private WeixinUserCardStatDao weixinUserCardStatDao;

	@Autowired
	private WeixinConf weixinConf;

	/**
	 * 用户领卡统计 年
	 * 
	 * @param year
	 *            '2015'
	 * @param cardId
	 * @param weixinId
	 * @return
	 */
	public List<WeixinUserCardStat> statForYear(String year, String cardId) {
		return weixinUserCardStatDao.statForYear(year, cardId, weixinConf.getPublicId());
	}

	/**
	 * 用户领卡统计 月
	 * 
	 * @param yearMonth
	 *            '2015-6'
	 * @param cardId
	 * @param weixinId
	 * @return
	 */
	public List<WeixinUserCardStat> statForMonth(String yearMonth, String cardId) {
		return weixinUserCardStatDao.statForMonth(yearMonth, cardId, weixinConf.getPublicId());
	}

}
